#include "mybuttonwidget.h"
#include "MyOpenButton.h"
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QPainter>
MyButtonWidget::MyButtonWidget(QWidget *parent)
    : QWidget{parent}
{
    QHBoxLayout* pMainLayout = new QHBoxLayout(this);
    pMainLayout->setContentsMargins(5,5,5,5);
    pMainLayout->setSpacing(5);
    QVBoxLayout* pVboxLayout = new QVBoxLayout(this);
    pVboxLayout->setContentsMargins(5,5,5,5);
    pVboxLayout->setSpacing(5);
    {
        MyOpenButton* pBtn = new MyOpenButton(120, 30, this);
        pVboxLayout->addStretch(1);
        pVboxLayout->addWidget(pBtn);
        pVboxLayout->addStretch(1);
        MyOpenButton* pBtn1 = new MyOpenButton(120, 30, this);

        pVboxLayout->addWidget(pBtn1);
        pVboxLayout->addStretch(1);

        MyOpenButton* pBtn2 = new MyOpenButton(120, 30, this);
        pBtn2->setFixedSize(120, 30);
        pVboxLayout->addWidget(pBtn2);
        pVboxLayout->addStretch(8);
    }
    pMainLayout->addLayout(pVboxLayout);
    pMainLayout->addStretch(1);
    this->setLayout(pMainLayout);
}

void MyButtonWidget::paintEvent(QPaintEvent *event)
{
    QPainter painter(this);
    painter.setRenderHint(QPainter::Antialiasing);
    painter.fillRect(rect(), Qt::black);
}
